package audit

type AuditContractInterface interface {
	UploadContractZip(zipPath, contractFileName string) (fileId, requestId string, err error)
	AuditUseFileId(fileId string) (taskId, requestId string, err error)
	QueryAuditStatusByTaskId(taskId, userSrcPath string) (retD *TaskData, err error)
}

// Issue 问题结构体
type Issue struct {
	TaskId     string `json:"taskId"` // add index
	ID         int    `json:"id"`
	Severity   int    `json:"severity"`
	Confidence int    `json:"confidence"`
	CweID      string `json:"cweId"`
	CweURL     string `json:"cweUrl"`
	RuleID     string `json:"ruleId"`
	Details    string `json:"details"`
	File       string `json:"file"`
	FilePath   string `json:"filePath"` // 这个需要根据File重新生成
	Code       string `json:"code"`
	Line       string `json:"line"`
	Col        string `json:"col"`
	NoSec      int    `json:"nosec"`
}

type TaskData struct {
	Status    string   `json:"status"`
	Result    []*Issue `json:"result"`
	Stat      *Metrics `json:"stat"`
	Error     string   `json:"error"`
	RequestId string   `json:"requestId"`
}
type Metrics struct {
	NumFiles int `json:"files"`
	NumLines int `json:"lines"`
	NumNosec int `json:"nosec"`
	NumFound int `json:"found"`
}

var (
	auditProcessor AuditContractInterface
)

func InitAuditAuditProcessor() {
	auditProcessor = new(AuditContractHttp)
}
